package com.csc.banking.model;

// Generated Jul 11, 2014 10:43:16 PM by Hibernate Tools 3.4.0.CR1

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

/**
 * Customers generated by hbm2java
 */
@Entity
@Table(name = "Customers",catalog = "mydb")
public class Customer implements EntityObject, java.io.Serializable
{

	private Long customerId;
	private Profile profile;
	private String userName;
	private String password;
	private Boolean isLock;
	private Boolean isRemovable;
	private Set<Transaction> transactions = new HashSet<Transaction>(0);
	private Set<Balance> balances = new HashSet<Balance>(0);	
	private Set<Lock> locks = new HashSet<Lock>(0);
	private Set<TransferAction> transferActions = new HashSet<TransferAction>(0);
	private static final long serialVersionUID = 1L;

	public Customer() {
	}

	public Customer(Profile profile, String userName, 
			String password, boolean isLock, boolean isRemovable) 
	{
		this.profile = profile;
		this.userName = userName;
		this.password = password;
		this.isLock = isLock;
		this.isRemovable = isRemovable;
	}

	public Customer(Profile profile, String userName, String password, 
			boolean isLock, boolean isRemovable, Set<Transaction> transactions,
			Set<Balance> balances, Set<Lock> locks, Set<TransferAction> transferActions) 
	{
		this.profile = profile;
		this.userName = userName;
		this.password = password;
		this.isLock = isLock;
		this.isRemovable = isRemovable;
		this.transactions = transactions;
		this.balances = balances;
		this.locks = locks;
		this.setTransferActions(transferActions);
	}

	@GenericGenerator(name = "generator", strategy = "foreign", parameters = @Parameter(name = "property", value = "profiles"))
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "CustomerId", unique = true, nullable = false)
	public Long getCustomerId() 
	{
		return this.customerId;
	}

	public void setCustomerId(Long customerId) 
	{
		this.customerId = customerId;
	}

	@OneToOne(fetch = FetchType.LAZY)
	@PrimaryKeyJoinColumn
	public Profile getProfile() 
	{
		return this.profile;
	}

	public void setProfile(Profile profile) 
	{
		this.profile = profile;
	}

	@Column(name = "UserName", unique = true, nullable = false, length = 45)
	public String getUserName() {
		return this.userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	@Column(name = "Password", nullable = false, length = 45)
	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column(name = "IsLock", nullable = false)
	public boolean getIsLock() {
		return this.isLock;
	}

	public void setIsLock(boolean isLock) {
		this.isLock = isLock;
	}

	@Column(name = "IsRemovable", nullable = false)
	public boolean isIsRemovable() {
		return this.isRemovable;
	}

	public void setIsRemovable(boolean isRemovable) 
	{
		this.isRemovable = isRemovable;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "customer")
	public Set<Transaction> getTransactions() 
	{
		return this.transactions;
	}

	public void setTransactions(Set<Transaction> transactions) 
	{
		this.transactions = transactions;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "customer")
	public Set<Balance> getBalances() 
	{
		return this.balances;
	}

	public void setBalances(Set<Balance> balances) 
	{
		this.balances = balances;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "customer")
	public Set<Lock> getLocks()
	{
		return this.locks;
	}

	public void setLocks(Set<Lock> locks) 
	{
		this.locks = locks;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "customer")
	public Set<TransferAction> getTransferActions() 
	{
		return transferActions;
	}

	public void setTransferActions(Set<TransferAction> transferActions) 
	{
		this.transferActions = transferActions;
	}

}
